package com.krt.webapp.activity;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.krt.webapp.until.AppInfo;
import com.krt.webapp.until.MyApplication;

public class StartActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //判断是否为第一次启动程序
        AppInfo appInfo = (new MyApplication(getApplication())).getAppInfo();
        SharedPreferences sharedPreferences = getSharedPreferences(appInfo.getSp_name(), 0);
        int i = sharedPreferences.getInt("ifopen", 0);
        Intent intent = new Intent();
        if (appInfo.getHasyd()) {
            if (i == 0) {
                intent.setClass(this, YDActivity.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
            } else {
                intent.setClass(this, WelcomeActivity.class);
            }
        } else {
            intent.setClass(this, WelcomeActivity.class);
        }

        startActivity(intent);
        finish();
    }


}
